package lab02.test34;

import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Created by Administrator on 2017/11/21.
 */
public class Test {
    public static void main(String[] args) {
        String a[]=new String[4];
        List<String> list = new ArrayList<>();
        list.add(a[0]="apple");
        list.add(a[1]="grape");
        list.add(a[2]="banana");
        list.add(a[3]="pear");
        Collections.sort(list, Collator.getInstance(java.util.Locale.CHINA));
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i));
        }
        String s=a[0],z=a[0];
        for (int j=1;j<4;j++){

            if (s.length()<a[j].length())
            {
                s=a[j];
            }
            else {
                z=a[j];
            }
        }

        System.out.println("最大值为"+s+","+"最小值为"+z);

    }
}
